<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .container{
        width: 300px;
        height: 400px;
        position: absolute;
        left: 50%;
        top: 50%;
        background-color: red;
        margin-left: -150px;/*对应元素宽度的一半,此时的宽度是border-box的盒模型宽度，包含了padding，此处的padding过大，导致整个盒模型是400x400像素*/
        margin-top: -200px; /*对应高度的一半*/
        box-sizing: border-box;

    }
 </style>
<body>
    <div class="container">111111
    </div>

</body>
</html>